#!/usr/bin/perl

use CGI;
$cgi = new CGI;

print "Content-type: text/html"."\n\n";

print <<HTMLHEAD;
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=EUC-JP">
</head>
<body>
HTMLHEAD

$filename = $cgi->param('file');

#print  "<h2>",$filename,"</h2>";

#$B>e$N3,AX$N%U%!%$%k$r8+$i$l$k$H$^$:$$!"!"!"(B
$filename =~ s/\.\.//g;

print  "<h2>",$filename,"</h2>";


open(FILE,$filename) or die "can't open test.html: $!";


print "<pre>";
while($line = <FILE>){
  chomp($line);
  #HTML$B$N%(%9%1!<%W(B
  $line =~ s/&/&amp;/g;
  $line =~ s/</&lt;/g;
  $line =~ s/>/&gt;/g;
  print $line,"<br>";
}
print "</pre>";

print <<HTMLFOOT;
</body>
</html>
HTMLFOOT

close(FILE);
